package com.dms.shanshan.beans;

import java.util.ArrayList;
import java.util.List;

/**
 * 属性值集合
 * 放置管理属性
 * Created by shanshan on 2018/3/19.
 */


public class PropertyValues {
    private  final List<PropertyValue> propertyValueList=new ArrayList<>();
    /**
     * 添加属性值 放入一个属性对象*/
    public void addPropertyValue(PropertyValue propertyValue){
        this.propertyValueList.add(propertyValue);
    }
    /**
     * 获取属性值集合转成的数组*/
    public PropertyValue[] getPropertyValues(){
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }
    /**
     * 根据属性名获取属性值*/
    public PropertyValue getPropertyValue(String propertyName){
        for (PropertyValue propertyValue:propertyValueList){
            if (propertyValue.getName().equals(propertyName)){
                return propertyValue;
            }
        }
        return null;
    }
}
